package com.example.cstr.service.serviceImpl;

import com.example.cstr.entity.Message;
import com.example.cstr.entity.StudyContain;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.example.cstr.entity.File;
import com.example.cstr.mapper.FileMapper;
import com.example.cstr.service.FileService;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Service
public class FileServiceImpl implements FileService {

    @Resource
    private FileMapper fileMapper;

    @Override
    public int deleteByPrimaryKey(Integer fileId) {
        return fileMapper.deleteByPrimaryKey(fileId);
    }

    @Override
    public int insert(File record) {
        return fileMapper.insert(record);
    }

    @Override
    public int insertSelective(File record) {
        return fileMapper.insertSelective(record);
    }

    @Override
    public File selectByPrimaryKey(Integer fileId) {
        return fileMapper.selectByPrimaryKey(fileId);
    }

    @Override
    public int updateByPrimaryKeySelective(File record) {
        return fileMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(File record) {
        return fileMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<File> selectAllFile() {
        return fileMapper.selectAllFile();
    }

    @Override
    public Message PagingSearch(@RequestParam Integer pageNum, @RequestParam Integer size) {
        PageHelper.startPage(pageNum, size);
        List<File> fileList = fileMapper.selectAllFile();
        PageInfo pageInfo = new PageInfo(fileList);
        pageInfo.getTotal();
        return Message.success(null).add(pageInfo);
    }

    @Override
    public List<File> selectFileInfoByscId(Integer scId) {
        return fileMapper.selectFileInfoByscId(scId);
    }

    @Override
    public int removeMyFileByOrdName(String fileName) {
        return fileMapper.removeMyFileByOrdName(fileName);
    }

}





